package procedure;

/**
 * 
 * Collection of SQL string for opertations related to Parameters. The table
 * P2PS links parameters to parameterSets - it is where the parameter value is
 * stored, since the value is different for each assignment of a parameter to a
 * parameterSet.
 * 
 * @author Daniel Funk
 * 
 */
public interface SQLParameterStringsI {

	public static final String PARAMETER_INSERT = "INSERT INTO Parameter (p_name, p_type, p_units, p_class, p_description) "
			+ "VALUES ('%s', '%s', '%s', '%s', '%s')";

	public static final String PARAMETER_SELECT = "SELECT p_id, p_name, p_type, p_units, p_class, p_description "
			+ "FROM Parameter WHERE p_id = %d";

	public static final String PARAMETER_SELECT_NAME = "SELECT p_name FROM Parameter WHERE p_id = %d";
	public static final String PARAMETER_SELECT_TYPE = "SELECT p_type FROM Parameter WHERE p_id = %d";
	public static final String PARAMETER_SELECT_UNITS = "SELECT p_units FROM Parameter WHERE p_id = %d";
	public static final String PARAMETER_SELECT_CLASS = "SELECT p_class FROM Parameter WHERE p_id = %d";
	public static final String PARAMETER_SELECT_DESCRIPTION = "SELECT p_description FROM Parameter WHERE p_id = %d";

	public static final String PARAMETER_SELECT_PARAMSETID = "SELECT p2ps_ps_id FROM P2Ps WHERE p2ps_p_id = %d";

	public static final String PARAMETER_SET_NAME = "UPDATE Parameter SET p_name = '%s' WHERE p_id = %d";
	public static final String PARAMETER_SET_TYPE = "UPDATE Parameter SET p_type = '%s' WHERE p_id = %d";
	public static final String PARAMETER_SET_UNITS = "UPDATE Parameter SET p_units = '%s' WHERE p_id = %d";
	public static final String PARAMETER_SET_CLASS = "UPDATE Parameter SET p_class = '%s' WHERE p_id = %d";
	public static final String PARAMETER_SET_DESCRIPTION = "UPDATE Parameter SET p_description = '%s' WHERE p_id = %d";

	public static final String PARAMETER_ADD_PARAMETERTOPARAMETERSET = "INSERT INTO P2Ps (p2ps_p_ID, p2ps_ps_ID, p2ps_value, p2ps_comment) "
			+ "VALUES (%d, %d, '%s', '%s')";

	public static final String PARAMETER_DELETE = "DELETE FROM Parameter WHERE p_id = %d";

	public static final String PARAMETER_COPY = "INSERT INTO Parameter (p_name, p_type, p_units, p_class, p_description) "
			+ "VALUES((SELECT p_name FROM Parameter WHERE p_id = %d), (SELECT p_type FROM Parameter WHERE p_id = %d), (SELECT p_units FROM Parameter WHERE p_id = %d), (SELECT p_class FROM Parameter WHERE p_id = %d), (SELECT p_description FROM Parameter WHERE p_id = %d))";

}
